home *** CD-ROM | disk | FTP | other *** search
/ Creating Your Own America Online Web Pages / Creating Your Own America Online Web Pages.iso / JAWAI / JAVABEAT / JAVABEAT.EXE / JAVABEAT.DXR / 00112.ls < prev    next >
Encoding:
Text File  |  1996-03-16  |  5.8 KB  |  217 lines

  1. on startMovie
  2.   global soundLevelSprite, APbutton, fileList, listOfLabels, themeList, firstAlert
  3.   set fileList to [:]
  4.   set listOfLabels to [:]
  5.   set themeList to [:]
  6.   set soundLevelSprite to 48
  7.   set APbutton to 9
  8.   set the volume of sound 1 to 255
  9.   set the volume of sound 2 to 255
  10.   set firstAlert to 1
  11.   set the textHeight of field "readout" to 16
  12.   set the textHeight of field "readout reset" to 16
  13.   resetReadout()
  14.   setListOfFiles()
  15.   setLIstOfLabels()
  16.   setListOfThemes()
  17.   when keyDown then soundKeyControl 
  18.   if the optionDown then
  19.     go("main")
  20.   end if
  21. end
  22.  
  23. on stopMovie
  24.   resetReadout()
  25.   when keyDown then nothing
  26.   set the text of field "name of inactive choice" to " "
  27. end
  28.  
  29. on setListOfFiles
  30.   global fileList
  31.   set fileList to [:]
  32.   repeat with x = 1 to the number of lines in field "file name lookup list"
  33.     addProp(fileList, item 1 of line x of field "file name lookup list", x)
  34.   end repeat
  35. end
  36.  
  37. on setLIstOfLabels
  38.   global listOfLabels
  39.   set listOfLabels to [:]
  40.   set numOflabels to the number of lines in field "song labels"
  41.   repeat with x = 7 to 6 + numOflabels
  42.     addProp(listOfLabels, x, line x - 6 of field "song labels")
  43.   end repeat
  44. end
  45.  
  46. on setListOfThemes
  47.   global themeList
  48.   set themeList to [:]
  49.   repeat with x = 1 to the number of lines in field "filenames of the 12 themes"
  50.     addProp(themeList, x, item 1 of line x of field "filenames of the 12 themes")
  51.   end repeat
  52. end
  53.  
  54. on turnOffAllSprites
  55.   repeat with x = 1 to 48
  56.     set the puppet of sprite x to 0
  57.   end repeat
  58. end
  59.  
  60. on resetReadout whichTracks
  61.   set the text of field "readout" to the text of field "readout reset"
  62. end
  63.  
  64. on playArandomTheme
  65.   global themeList
  66.   set fileToPlay to getaProp(themeList, random(count(themeList)))
  67.   if the machineType = 256 then
  68.     set soundToPlay to fileToPlay & ".wav"
  69.     sound playFile 1, fileToPlay
  70.   else
  71.     sound playFile 1, fileToPlay
  72.   end if
  73. end
  74.  
  75. on copyAlert
  76.   alert("In the full version of Java Beat, this button copies the selected " & "audio segment to your hard drive.")
  77. end
  78.  
  79. on showAnAlert
  80.   global firstAlert
  81.   if firstAlert then
  82.     alert(the text of field "first Alert")
  83.     set firstAlert to 0
  84.   else
  85.     alert(line random(the number of lines in field "alert list") of field "alert list")
  86.   end if
  87. end
  88.  
  89. on goToAnInctiveChoice soundToPlay
  90.   global listOfLabels
  91.   sound stop 1
  92.   sound stop 2
  93.   set the text of field "name of inactive choice" to the name of cast the castNum of sprite the clickOn
  94.   set frameToGoTo to getaProp(listOfLabels, the clickOn)
  95.   if the labelList contains frameToGoTo then
  96.     go(frameToGoTo)
  97.   else
  98.     alert("handler goToAnInctiveChoice was unable to get the targeted label")
  99.   end if
  100.   if stringp(soundToPlay) then
  101.     if the machineType = 256 then
  102.       sound stop 1
  103.       set soundToPlay to soundToPlay & ".wav"
  104.       sound playFile 1, soundToPlay
  105.     else
  106.       sound stop 2
  107.       set soundToPlay to soundToPlay
  108.       sound playFile 2, soundToPlay
  109.     end if
  110.   end if
  111. end
  112.  
  113. on returnFromAnInctiveChoice
  114.   sound stop 1
  115.   go("main")
  116. end
  117.  
  118. on quitThisMovie
  119.   global soundLevelSprite
  120.   sound stop 1
  121.   sound stop 2
  122.   set the puppet of sprite soundLevelSprite to 0
  123.   put "soundlevel sprite = " & soundLevelSprite && the puppet of sprite soundLevelSprite
  124.   go("quitFrame")
  125. end
  126.  
  127. on playSoundFromclickList
  128.   global fileList
  129.   set clickedLine to the mouseLine
  130.   set fieldToUse to the name of cast the castNum of sprite the clickOn
  131.   set soundDescription to line clickedLine of field fieldToUse
  132.   sound stop 1
  133.   sound stop 2
  134.   hilite line clickedLine of field fieldToUse
  135.   set fileNumber to getaProp(fileList, soundDescription)
  136.   set fileName to item 2 of line fileNumber of field "file name lookup list"
  137.   set fileRate to item 3 of line fileNumber of field "file name lookup list"
  138.   set fileLength to item 4 of line fileNumber of field "file name lookup list"
  139.   if the machineType = 256 then
  140.     set fileName to fileName & ".WAV"
  141.   end if
  142.   set soundToPlay to fileName
  143.   sound playFile 2, soundToPlay
  144.   put fileName into line 1 of newReadout
  145.   put fileRate into line 2 of newReadout
  146.   put "   " & fileLength into word 2 of line 2 of newReadout
  147.   put newReadout into field "readOut"
  148. end
  149.  
  150. on soundKeyControl
  151.   if the key = 0 then
  152.     setSoundLevelMeter(0)
  153.   else
  154.     if (the key >= 1) and (the key <= 9) then
  155.       setSoundLevelMeter(the key)
  156.     end if
  157.   end if
  158.   dontPassEvent()
  159. end
  160.  
  161. on setSoundLevelMeter whichLevel
  162.   global userVolumeLevel, soundLevelSprite
  163.   if whichLevel < 0 then
  164.     set whichLevel to 0
  165.   else
  166.     if whichLevel > 9 then
  167.       set whichLevel to 9
  168.     end if
  169.   end if
  170.   set newSoundLevel to 28 * whichLevel
  171.   set the volume of sound 1 to newSoundLevel
  172.   set the volume of sound 2 to newSoundLevel
  173.   set userVolumeLevel to newSoundLevel
  174.   set soundlevelToShow to "sound level " & string(whichLevel)
  175.   set the castNum of sprite soundLevelSprite to the number of cast soundlevelToShow
  176.   updateStage()
  177. end
  178.  
  179. on threeDbutton whereToGoOrWhatToDo
  180.   set cOn to the clickOn
  181.   set mouseDownTime to the timer
  182.   set originalCastNum to the castNum of sprite cOn
  183.   set newCastNum to the castNum of sprite cOn + 1
  184.   set the puppet of sprite cOn to 1
  185.   set the castNum of sprite cOn to newCastNum
  186.   updateStage()
  187.   set rollOn to 1
  188.   repeat while the stillDown
  189.     if rollOver(cOn) and not rollOn then
  190.       set the castNum of sprite cOn to newCastNum
  191.       updateStage()
  192.       set rollOn to 1
  193.       next repeat
  194.     end if
  195.     if not rollOver(cOn) and rollOn then
  196.       set the castNum of sprite cOn to originalCastNum
  197.       updateStage()
  198.       set rollOn to 0
  199.     end if
  200.   end repeat
  201.   repeat while (mouseDownTime + 10) > the timer
  202.     nothing()
  203.   end repeat
  204.   if rollOn = 1 then
  205.     set the castNum of sprite cOn to originalCastNum
  206.     set the puppet of sprite cOn to 0
  207.     updateStage()
  208.   end if
  209.   if rollOn and stringp(whereToGoOrWhatToDo) then
  210.     if the labelList contains whereToGoOrWhatToDo then
  211.       go(whereToGoOrWhatToDo)
  212.     else
  213.       do(whereToGoOrWhatToDo)
  214.     end if
  215.   end if
  216. end
  217.